Is it possible to scale up character-by-character across a single 2D text node?
For example, if you had the word ZOOM on the screen, the effect would look like Zoom - ZOOM - ZOOM - ZOOM - ZOOM.
Hello Ventuzians!
THE FORUMS ARE CLOSED!
Please join our discord server HERE!! << click me
We are shutting our Ventuz Forum, but don't worry, it will all be archived for you to search in if you have a query. From now on, please add all your comments, questions or observations into our Discord Server
Thanks for the great time - see you on discord!!
Dee, Karol, Daniel and the whoooole Product and Support team!
THE FORUMS ARE CLOSED!
Please join our discord server HERE!! << click me
We are shutting our Ventuz Forum, but don't worry, it will all be archived for you to search in if you have a query. From now on, please add all your comments, questions or observations into our Discord Server
Thanks for the great time - see you on discord!!
Dee, Karol, Daniel and the whoooole Product and Support team!
Possible to do a character by character zoom on text?
Moderator: Support
-
- Posts: 49
- Joined: 27 Nov 2012, 21:53
Re: Possible to do a character by character zoom on text?
Hey,
try the enriched block text provider. Here you can use HTML-like syntax to scale your text. E.g.
You can add the style-tags either with a Script or Expression node. Consider using a multiline expression and iterating over the string using a loop:
This is just a starting point and you probably have to add your logic to decide which characters should be scaled and by what value.
Best
Stephen
try the enriched block text provider. Here you can use HTML-like syntax to scale your text. E.g.
Code: Select all
Z<style scale="2">O</style>O<style scale="0.5">M</style>
Code: Select all
{
Random rand = new Random();
string result = "";
string doubleScaleStart = "<style scale=\"2.0\">";
string doubleScaleEnd = "</style>";
foreach(char c in A)
{
if(rand.NextDouble() < 0.5)
result += string.Format("{0}{1}{2}", doubleScaleStart, c, doubleScaleEnd);
else
result += c;
}
return result;
}
Best
Stephen
-
- Posts: 49
- Joined: 27 Nov 2012, 21:53
Re: Possible to do a character by character zoom on text?
Thanks for the suggestion however I don't believe that will work for my application.
I'm looking to smoothly scale each letter up and then back again. Think of a magnifying glass passing across the word.
I'm looking to smoothly scale each letter up and then back again. Think of a magnifying glass passing across the word.
Re: Possible to do a character by character zoom on text?
Then simply change the condition for the scaling as well as the scale value in the suggested expression's logic. As said, above example is just an idea on how to accomplish the scaling at all and you have to adjust that to your exact needs.
Here you have an expression that maybe goes more into the direction you want. Animate the values in the "Progresses" array to move the zoom effect along the string. Scale Range is some value between 0 and 1 - 1 means the zoom effect is spread across the length of the string. ScaleValue is the strength of the scale at the highest point.
Here you have an expression that maybe goes more into the direction you want. Animate the values in the "Progresses" array to move the zoom effect along the string. Scale Range is some value between 0 and 1 - 1 means the zoom effect is spread across the length of the string. ScaleValue is the strength of the scale at the highest point.
Code: Select all
Parameters:
String A
float[] Progresses
float ScaleRange
float ScaleValue
Expression:
{
string result = "";
string scaleStart1 = "<style scale=\"";
string scaleStart2 = "\">";
string scaleEnd = "</style>";
int length = A.Length;
for(int i = 0; i < length; i++)
{
float normalizedPosition = (float)i / (float)length;
float scale = 1.0f;
foreach(float p in Progresses)
{
scale += Math.Max(0, (ScaleRange - Math.Abs(normalizedPosition - p))) / ScaleRange * (ScaleValue - 1.0f);
}
scale += 1.0f;
result += string.Format("{0}{1}{2}{3}{4}", scaleStart1, scale.ToString(System.Globalization.CultureInfo.InvariantCulture), scaleStart2, A[i], scaleEnd);
}
return result;
}
-
- Posts: 49
- Joined: 27 Nov 2012, 21:53
Re: Possible to do a character by character zoom on text?
I got this to basically work using your suggestion. One issue I did see was when I scaled up ANY letter within the word, it would shift the baseline of the entire word. I used the yoffset to center the character vertically but the entire word line still shifts. I used a workaround of modifying the Y Position of its axis. Not elegant, but it seems to work.