forum

I have questions. .

posted
Total Posts
14
Topic Starter
arviejhay
Hi, i create storyboards using osbpy/python programming language. I have some questions.

1.) how to make a circle movements? I already know how to make curve movements by manipulating moveX and moveY with easings. I already tried doing it but it ended up getting messed up

2.) how to make the lyrics made of individual sprites (dots) like in exile-'s storyboard or something. I already know how to make lyrics with individual letters except for creating images (letters) via code. I do that on image editor.

3.) how to create a spectrum only using a final vecScaleY with a value of 0?

Example.

=====
======== =
=============
======== =
=====

this is a normal spectrum, what i want is

-------------------------------------------------------

=====
======== =
=============

OR

=============
======== =
=====
Starrodkirby86
  1. There's many ways of approaching, but one way you can go at it (Thanks Jakomo73!) would be using MoveX and MoveY commands alternating between InSine and OutSine easings for how many points you want for your circle. For your points in the circle, you can calculate it by using these equations for rotation:
    x = origin_x + r*cos(θ)
    y = origin_y + r*sin(θ)
    With r being the circle's radius and θ being the angle.
  2. In Python, you'd likely need to use an image editing library like Pillow, import the image as a data type, and then analyze it pixel by pixel at the time. You basically have a 2D array. In Pillow, you can grab an individual pixel through something like getdata or load. Just keep in mind that if you analyze each individual pixel, it can get extremely expensive fast, and your .osb size or performance might dip considerably. You could alleviate this by analyzing every other pixel, shrinking the image, and things like that.
  3. Uhh, I can barely see a difference, other than you have it clamped like it's against a maximum spectrum or something? :? I also don't understand the initial question too. Is your scaleVector for y initialized at 0 or something?
Topic Starter
arviejhay

Starrodkirby86 wrote:

  1. There's many ways of approaching, but one way you can go at it (Thanks Jakomo73!) would be using MoveX and MoveY commands alternating between InSine and OutSine easings for how many points you want for your circle. For your points in the circle, you can calculate it by using these equations for rotation:
    x = origin_x + r*cos(θ)
    y = origin_y + r*sin(θ)
    With r being the circle's radius and θ being the angle.
  2. In Python, you'd likely need to use an image editing library like Pillow, import the image as a data type, and then analyze it pixel by pixel at the time. You basically have a 2D array. In Pillow, you can grab an individual pixel through something like getdata or load. Just keep in mind that if you analyze each individual pixel, it can get extremely expensive fast, and your .osb size or performance might dip considerably. You could alleviate this by analyzing every other pixel, shrinking the image, and things like that.
  3. Uhh, I can barely see a difference, other than you have it clamped like it's against a maximum spectrum or something? :? I also don't understand the initial question too. Is your scaleVector for y initialized at 0 or something?

I only need the half of the spectrum. Too bad the spaces on the first are trimmed on the example of the first post. Thats why you are confused. Example of maps like neurocian (i dont know if thats the correct spelling) and just 4 you (nightcore mix) xincrin`s storyboard
Starrodkirby86
In that case, think of it like this. The FFT for the spectrum should return you the various magnitudes for each bar. Since the spectrum sprites' default origin are at the center, a scale vector Y would make it raise from the bottom and top. Just set the origin to something that's anchored to the bottom or top, and the scaling will correspond to that.
Topic Starter
arviejhay

Starrodkirby86 wrote:

In that case, think of it like this. The FFT for the spectrum should return you the various magnitudes for each bar. Since the spectrum sprites' default origin are at the center, a scale vector Y would make it raise from the bottom and top. Just set the origin to something that's anchored to the bottom or top, and the scaling will correspond to that.
oh ok, thank you so much!

one last questions, about what i said in the first post, "I already know how to make lyrics with individual letters except for creating images (letters) via code. I do that on image editor.". Yes, i know how to make lyrics using individual letters but not 100% perfect because i'm having trouble setting the gaps of each letters. Instead of showing in the SB "Hello World!", it shows "He l lo Wo r l d !" or "My se lf" instead of "Myself". How do i fix this?
Starrodkirby86
Ooh, that should be an issue with kerning. When you usually render text with fonts, fonts have an internal kerning that makes their juxtaposition together look appealing to each other. But when we have the letters, they're often equally monospaced, which looks awkward unless you use a monospaced font. One approach could be the following:

The problem you want to solve: You want to get the proper spacing for letters, and you know how to generate individual letters with code. But letters are of variable width, making text output weird.

Try this out --- since you can generate the letter, you should be able to get the width for this sprite. You may be able to add this width into a counter variable that can help you offset the next character, and then you do the same for the next one, and so on until you reach the end of the line. Depending on your font's scale, you may need to adjust that offset with a scale factor, which we'll call scalar.

So it'd be something like:
1) Generate the text character sprite.
2) Find the width of that sprite, let's call it baseWidth.
3) If the sprite is not " " or the end of a line, go to 3a. If it's " ", go to 3b. If it's the end of a line, go to 3c.
3a) offsetX += mySprite.baseWidth * (scalar)
3b) offsetX += (spaceValue) * (scalar)
3c) offsetX = 0, end loop
4) Repeat steps 1-3 until end of line
Topic Starter
arviejhay

Starrodkirby86 wrote:

Ooh, that should be an issue with kerning. When you usually render text with fonts, fonts have an internal kerning that makes their juxtaposition together look appealing to each other. But when we have the letters, they're often equally monospaced, which looks awkward unless you use a monospaced font. One approach could be the following:

The problem you want to solve: You want to get the proper spacing for letters, and you know how to generate individual letters with code. But letters are of variable width, making text output weird.

Try this out --- since you can generate the letter, you should be able to get the width for this sprite. You may be able to add this width into a counter variable that can help you offset the next character, and then you do the same for the next one, and so on until you reach the end of the line. Depending on your font's scale, you may need to adjust that offset with a scale factor, which we'll call scalar.

So it'd be something like:
1) Generate the text character sprite.
2) Find the width of that sprite, let's call it baseWidth.
3) If the sprite is not " " or the end of a line, go to 3a. If it's " ", go to 3b. If it's the end of a line, go to 3c.
3a) offsetX += mySprite.baseWidth * (scalar)
3b) offsetX += (spaceValue) * (scalar)
3c) offsetX = 0, end loop
4) Repeat steps 1-3 until end of line
thank you so much! :D :)
imma try coding this later
Topic Starter
arviejhay

Starrodkirby86 wrote:

Ooh, that should be an issue with kerning. When you usually render text with fonts, fonts have an internal kerning that makes their juxtaposition together look appealing to each other. But when we have the letters, they're often equally monospaced, which looks awkward unless you use a monospaced font. One approach could be the following:

The problem you want to solve: You want to get the proper spacing for letters, and you know how to generate individual letters with code. But letters are of variable width, making text output weird.

Try this out --- since you can generate the letter, you should be able to get the width for this sprite. You may be able to add this width into a counter variable that can help you offset the next character, and then you do the same for the next one, and so on until you reach the end of the line. Depending on your font's scale, you may need to adjust that offset with a scale factor, which we'll call scalar.

So it'd be something like:
1) Generate the text character sprite.
2) Find the width of that sprite, let's call it baseWidth.
3) If the sprite is not " " or the end of a line, go to 3a. If it's " ", go to 3b. If it's the end of a line, go to 3c.
3a) offsetX += mySprite.baseWidth * (scalar)
3b) offsetX += (spaceValue) * (scalar)
3c) offsetX = 0, end loop
4) Repeat steps 1-3 until end of line
hi again,
I have tried what you have said, and. . .
i have been getting some unwanted gaps tho especially on short width images like i,l,t,r??. Instead of "t h i n k" (ignore the spaces tho, so i can give example better lol), it shows "t hi n k" or "el s e" instead or "e l s e" or "r e mi n d" instead of "r e m i n d" (the m and i overlaps)
i have tried to increase the X if this letter is i or l or t etc, some of them are fixed, or the problem just appears in some part.

the scalar means, the scale of each letter? i have set them in 0.3 tho because if i set it to 1 then it will be big tho.
Starrodkirby86
I guess that's like a FontScale, yeah.

Hmm, I was chatting with Jakomo73 about a bit of this more, and this should more or less work, hopefully.

Will write in pseudocode:
offset_x = 0
for all letters in line do:
letter_sprite = render_letter_text_sprite(letter)
letter_x = offset_x + letter_sprite.baseWidth * 0.5
letter_sprite.do_storyboard_effects_here_using_letter_x()
offset_x += letter_sprite.baseWidth

If you find that some letters are still a little too cramped, try adding an additional value inside the letter_x equation, so it'd be like (offset_x + letter.BaseWidth*0.5 + outlineThickness), where outlineThickness is this new value. Trial and error. xDD

Hopefully it should work. I actually think this should keep spaces in mind too, as long as spaces get generated and have a width that isn't blanked out or anything.

The more important part to get out of it would be the additive part. xD
Topic Starter
arviejhay

Starrodkirby86 wrote:

I guess that's like a FontScale, yeah.

Hmm, I was chatting with Jakomo73 about a bit of this more, and this should more or less work, hopefully.

Will write in pseudocode:
offset_x = 0
for all letters in line do:
letter_sprite = render_letter_text_sprite(letter)
letter_x = offset_x + letter_sprite.baseWidth * 0.5
letter_sprite.do_storyboard_effects_here_using_letter_x()
offset_x += letter_sprite.baseWidth

If you find that some letters are still a little too cramped, try adding an additional value inside the letter_x equation, so it'd be like (offset_x + letter.BaseWidth*0.5 + outlineThickness), where outlineThickness is this new value. Trial and error. xDD

Hopefully it should work. I actually think this should keep spaces in mind too, as long as spaces get generated and have a width that isn't blanked out or anything.

The more important part to get out of it would be the additive part. xD
i have tried that and. . .
it creates big gaps between letters tho, it made my problems worse xD. i think i have a wrong implementation of the code? can you please check it? again, i'm using osbpy by Wafu

here's my noob code
"haw to generate"
def TextGenerator(text,startTime,endTime,startX,endX,yPos,scale,opacity,red,green,blue,typeE):
delay = 0
offsetX = 0
letterX = 0
for index in text:
if (index != " "):
letter = index
if (letter.isupper() == True):
letter = letter.title() + "1"
if (letter == "'"):
letter = "ap"
elif (letter == "-"):
letter = "da"
Text = osbject("11t-fonts\\" + letter + ".png","Foreground","Centre",320,240)
baseWidth,baseHeight = get_image_size("D:\\osu\\Songs\\i_touch_myself\\11t-fonts\\" + letter + ".png")
letterX = offsetX + (baseWidth * 0.5)
if (typeE == "Random"):
randX = random.randint(-100,750)
randY = random.randint(-50,500)
Text.fade(0,(startTime - 500) + delay,startTime + delay,0,opacity)
Text.move(1,(startTime - 500) + delay,startTime + delay,randX,randY,round(letterX) + startX,yPos)
Text.move(1,startTime + delay,startTime + delay + abs((startTime - endTime)),round(letterX) + startX,yPos,round(letterX) + endX,yPos)
elif (typeE == ""):
Text.fade(0,startTime + delay,startTime + delay + abs((startTime - (endTime - 500))),0,opacity)
Text.move(1,startTime + delay,startTime + delay + abs((startTime - endTime)),round(letterX) + startX,yPos,round(letterX) + endX,yPos)
Text.para(0,startTime + delay,startTime + delay,"A")
Text.scale(0,startTime + delay,startTime + delay,scale,scale)
Text.fade(0,startTime + delay + abs((startTime - (endTime - 500))),startTime + delay + abs((startTime - endTime)),opacity,0)
Text.colour(0,startTime + delay,startTime + delay,red,green,blue,red,green,blue)

delay += 25
offsetX += baseWidth

elif (index == " "):
offsetX += 50 * scale
return;
function for get_image_size
def get_image_size(fname):
'''Determine the image type of fhandle and return its size.
from draco'''
with open(fname, 'rb') as fhandle:
head = fhandle.read(24)
if len(head) != 24:
return
if imghdr.what(fname) == 'png':
check = struct.unpack('>i', head[4:8])[0]
if check != 0x0d0a1a0a:
return
width, height = struct.unpack('>ii', head[16:24])
elif imghdr.what(fname) == 'gif':
width, height = struct.unpack('<HH', head[6:10])
elif imghdr.what(fname) == 'jpeg':
try:
fhandle.seek(0) # Read 0xff next
size = 2
ftype = 0
while not 0xc0 <= ftype <= 0xcf:
fhandle.seek(size, 1)
byte = fhandle.read(1)
while ord(byte) == 0xff:
byte = fhandle.read(1)
ftype = ord(byte)
size = struct.unpack('>H', fhandle.read(2))[0] - 2
# We are at a SOFn block
fhandle.seek(1, 1) # Skip `precision' byte.
height, width = struct.unpack('>HH', fhandle.read(4))
except Exception: #IGNORE:W0703
return
else:
return
return width, height
Example function call
TextGenerator("I Love Myself",967,2376,50,100,200,0.3,1,0,128,255,"Random")
TextGenerator("I want you to love me",2376,3608,50,100,200,0.3,1,0,128,255,"Random")
TextGenerator("When i'm feeling down",3784,5017,50,100,200,0.3,1,0,128,255,"Random")
TextGenerator("I want you above me",5193,6425,50,100,200,0.3,1,0,128,255,"Random")
TextGenerator("I searched myself",6601,7834,50,100,200,0.3,1,0,128,255,"Random")
TextGenerator("I want you to find me",8010,9242,50,100,200,0.3,1,0,128,255,"Random")
TextGenerator("I forget myself",9242,12411,50,100,200,0.3,1,0,128,255,"Random")
TextGenerator("I want you to remind me",10474,12411,50,100,300,0.3,1,0,128,255,"Random")
Jakomo73
You need to scale the base width with your scale ^^ when I was talking with kirby I thought you were generating the fonts too, mb
Topic Starter
arviejhay

Jakomo73 wrote:

You need to scale the base width with your scale ^^ when I was talking with kirby I thought you were generating the fonts too, mb
"when I was talking with kirby I thought you were generating the fonts too, mb"

i can't do that xD, i said this in my first post "I already know how to make lyrics with individual letters except for creating (generating) images (letters/fonts) via code. I create fonts (letters) on image editor or i use someone's fonts tho. I'm using 11t-fonts folder"

"You need to scale the base width with your scale ^^"

what do you mean? like letterX = offsetX + (baseWidth * scale)?? or offsetX += baseWidth * scale??

EDIT: i fixed it by doing this tho,
letterX = offsetX + (baseWidth * scale) * 0.5
offsetX += baseWidth * scale

Thank you so much guys! :) :D
Starrodkirby86
Yeah, we thought you had them generated or something. xD But being able to grab the image's width is similar too.

Glad it's all fixed! :)

This is kind of another tangent, but if you'd like, you're more than welcome to join our Storyboarders' Discord, Osu! Storyboarder Banquet. We're all a pretty chill group and the biggest tenet we have there is to share interest in storyboarding and improve and learn. So you're always welcome to come on by. :p
Topic Starter
arviejhay

Starrodkirby86 wrote:

Yeah, we thought you had them generated or something. xD But being able to grab the image's width is similar too.

Glad it's all fixed! :)

This is kind of another tangent, but if you'd like, you're more than welcome to join our Storyboarders' Discord, Osu! Storyboarder Banquet. We're all a pretty chill group and the biggest tenet we have there is to share interest in storyboarding and improve and learn. So you're always welcome to come on by. :p
sure why not? :D
Please sign in to reply.

New reply