3.4 version
- Mr. Kibernetik
- Site Admin
- Posts: 4786
- Joined: Mon Nov 19, 2012 10:16 pm
- My devices: iPhone, iPad, MacBook
- Location: Russia
- Flag:
Re: 3.4 version
"Pause" will also pause sprites animation.
- Mr. Kibernetik
- Site Admin
- Posts: 4786
- Joined: Mon Nov 19, 2012 10:16 pm
- My devices: iPhone, iPad, MacBook
- Location: Russia
- Flag:
Re: 3.4 version
Graphics commands will be able to use different compositing modes. Also it will be possible to erase background to get images with transparency.
For this purpose new command will be added:
GRAPHICS MODE X
sets graphics commands compositing mode to X, where X is one of the modes listed below (R = premultiplied result; S = source color and alpha; D = destination color and alpha; Ra, Sa, Da = alpha components of R, S, D). Default mode is "NORMAL".
NORMAL : Paints the source image samples over the background image samples.
MULTIPLY : Multiplies the source image samples with the background image samples. This results in colors that are at least as dark as either of the two contributing sample colors.
SCREEN : Multiplies the inverse of the source image samples with the inverse of the background image samples. This results in colors that are at least as light as either of the two contributing sample colors.
OVERLAY : Either multiplies or screens the source image samples with the background image samples, depending on the background color. The result is to overlay the existing image samples while preserving the highlights and shadows of the background.
DARKEN : Creates the composite image samples by choosing the darker samples (either from the source image or the background). The result is that the background image samples are replaced by any source image samples that are darker.
LIGHTEN : Creates the composite image samples by choosing the lighter samples (either from the source image or the background). The result is that the background image samples are replaced by any source image samples that are lighter.
COLORDODGE : Brightens the background image samples to reflect the source image samples. Source image sample values that specify black do not produce a change.
COLORBURN : Darkens the background image samples to reflect the source image samples. Source image sample values that specify white do not produce a change.
SOFTLIGHT : Either darkens or lightens colors, depending on the source image sample color. If the source image sample color is lighter than 50% gray, the background is lightened, similar to dodging. If the source image sample color is darker than 50% gray, the background is darkened, similar to burning. If the source image sample color is equal to 50% gray, the background is not changed. Image samples that are equal to pure black or pure white produce darker or lighter areas, but do not result in pure black or white. The overall effect is similar to what you’d achieve by shining a diffuse spotlight on the source image. Use this to add highlights to a scene.
HARDLIGHT : Either multiplies or screens colors, depending on the source image sample color. If the source image sample color is lighter than 50% gray, the background is lightened, similar to screening. If the source image sample color is darker than 50% gray, the background is darkened, similar to multiplying. If the source image sample color is equal to 50% gray, the background is not changed. Image samples that are equal to pure black or pure white result in pure black or white. The overall effect is similar to what you’d achieve by shining a harsh spotlight on the source image. Use this to add highlights to a scene.
DIFFERENCE : Subtracts either the source image sample color from the background image sample color, or the reverse, depending on which sample has the greater brightness value. Source image sample values that are black produce no change; white inverts the background color values.
EXCLUSION : Produces an effect similar to that produced by "DIFFERENCE", but with lower contrast. Source image sample values that are black don’t produce a change; white inverts the background color values.
HUE : Uses the luminance and saturation values of the background with the hue of the source image.
SATURATION : Uses the luminance and hue values of the background with the saturation of the source image. Areas of the background that have no saturation (that is, pure gray areas) don’t produce a change.
COLOR : Uses the luminance values of the background with the hue and saturation values of the source image. This mode preserves the gray levels in the image. You can use this mode to color monochrome images or to tint color images.
LUMINOSITY : Uses the hue and saturation of the background with the luminance of the source image. This mode creates an effect that is inverse to the effect created by "COLOR".
CLEAR : R = 0. Effectively removes background.
COPY : R = S. Replaces background with source image.
SOURCEIN : R = S*Da
SOURCEOUT : R = S*(1 - Da)
SOURCEATOP : R = S*Da + D*(1 - Sa)
DESTOVER : R = S*(1 - Da) + D
DESTIN : R = D*Sa
DESTOUT : R = D*(1 - Sa)
DESTATOP : R = S*(1 - Da) + D*Sa
XOR : R = S*(1 - Da) + D*(1 - Sa).
PLUSDARKER : R = MAX(0, 1 - ((1 - D) + (1 - S)))
PLUSLIGHTER : R = MIN(1, S + D)
Example:
GRAPHICS
FILL RECT 50,50 SIZE 50
GRAPHICS MODE CLEAR
FILL RECT 50,50 SIZE 25
For this purpose new command will be added:
GRAPHICS MODE X
sets graphics commands compositing mode to X, where X is one of the modes listed below (R = premultiplied result; S = source color and alpha; D = destination color and alpha; Ra, Sa, Da = alpha components of R, S, D). Default mode is "NORMAL".
NORMAL : Paints the source image samples over the background image samples.
MULTIPLY : Multiplies the source image samples with the background image samples. This results in colors that are at least as dark as either of the two contributing sample colors.
SCREEN : Multiplies the inverse of the source image samples with the inverse of the background image samples. This results in colors that are at least as light as either of the two contributing sample colors.
OVERLAY : Either multiplies or screens the source image samples with the background image samples, depending on the background color. The result is to overlay the existing image samples while preserving the highlights and shadows of the background.
DARKEN : Creates the composite image samples by choosing the darker samples (either from the source image or the background). The result is that the background image samples are replaced by any source image samples that are darker.
LIGHTEN : Creates the composite image samples by choosing the lighter samples (either from the source image or the background). The result is that the background image samples are replaced by any source image samples that are lighter.
COLORDODGE : Brightens the background image samples to reflect the source image samples. Source image sample values that specify black do not produce a change.
COLORBURN : Darkens the background image samples to reflect the source image samples. Source image sample values that specify white do not produce a change.
SOFTLIGHT : Either darkens or lightens colors, depending on the source image sample color. If the source image sample color is lighter than 50% gray, the background is lightened, similar to dodging. If the source image sample color is darker than 50% gray, the background is darkened, similar to burning. If the source image sample color is equal to 50% gray, the background is not changed. Image samples that are equal to pure black or pure white produce darker or lighter areas, but do not result in pure black or white. The overall effect is similar to what you’d achieve by shining a diffuse spotlight on the source image. Use this to add highlights to a scene.
HARDLIGHT : Either multiplies or screens colors, depending on the source image sample color. If the source image sample color is lighter than 50% gray, the background is lightened, similar to screening. If the source image sample color is darker than 50% gray, the background is darkened, similar to multiplying. If the source image sample color is equal to 50% gray, the background is not changed. Image samples that are equal to pure black or pure white result in pure black or white. The overall effect is similar to what you’d achieve by shining a harsh spotlight on the source image. Use this to add highlights to a scene.
DIFFERENCE : Subtracts either the source image sample color from the background image sample color, or the reverse, depending on which sample has the greater brightness value. Source image sample values that are black produce no change; white inverts the background color values.
EXCLUSION : Produces an effect similar to that produced by "DIFFERENCE", but with lower contrast. Source image sample values that are black don’t produce a change; white inverts the background color values.
HUE : Uses the luminance and saturation values of the background with the hue of the source image.
SATURATION : Uses the luminance and hue values of the background with the saturation of the source image. Areas of the background that have no saturation (that is, pure gray areas) don’t produce a change.
COLOR : Uses the luminance values of the background with the hue and saturation values of the source image. This mode preserves the gray levels in the image. You can use this mode to color monochrome images or to tint color images.
LUMINOSITY : Uses the hue and saturation of the background with the luminance of the source image. This mode creates an effect that is inverse to the effect created by "COLOR".
CLEAR : R = 0. Effectively removes background.
COPY : R = S. Replaces background with source image.
SOURCEIN : R = S*Da
SOURCEOUT : R = S*(1 - Da)
SOURCEATOP : R = S*Da + D*(1 - Sa)
DESTOVER : R = S*(1 - Da) + D
DESTIN : R = D*Sa
DESTOUT : R = D*(1 - Sa)
DESTATOP : R = S*(1 - Da) + D*Sa
XOR : R = S*(1 - Da) + D*(1 - Sa).
PLUSDARKER : R = MAX(0, 1 - ((1 - D) + (1 - S)))
PLUSLIGHTER : R = MIN(1, S + D)
Example:
GRAPHICS
FILL RECT 50,50 SIZE 50
GRAPHICS MODE CLEAR
FILL RECT 50,50 SIZE 25
- Mr. Kibernetik
- Site Admin
- Posts: 4786
- Joined: Mon Nov 19, 2012 10:16 pm
- My devices: iPhone, iPad, MacBook
- Location: Russia
- Flag:
Re: 3.4 version
New command will be added:
SPRITES DELETE
completely deletes all sprites, both visible and hidden.
SPRITES DELETE
completely deletes all sprites, both visible and hidden.
- Mr. Kibernetik
- Site Admin
- Posts: 4786
- Joined: Mon Nov 19, 2012 10:16 pm
- My devices: iPhone, iPad, MacBook
- Location: Russia
- Flag:
Re: 3.4 version
New command will be added:
SPRITE n$ DA a DS s DX x DY y
sets regular change of specified parameters of the sprite [n$] with each animation turn. DA parameter sets change of angle by value [a], DS - scale by value [s], DX - x-coordinate by value [x], DY - y-coordinate by value [y]. Each parameter is optional but at least one should be specified. OPTION ANGLE command affects the value of DA parameter.
SPRITE n$ DA a DS s DX x DY y
sets regular change of specified parameters of the sprite [n$] with each animation turn. DA parameter sets change of angle by value [a], DS - scale by value [s], DX - x-coordinate by value [x], DY - y-coordinate by value [y]. Each parameter is optional but at least one should be specified. OPTION ANGLE command affects the value of DA parameter.
- Dutchman
- Posts: 851
- Joined: Mon May 06, 2013 9:21 am
- My devices: iMac, iPad Air, iPhone
- Location: Netherlands
- Flag:
Re: 3.4 version
It is not clear to me what you mean with changing "with each animation turn".
Is the change done after each cycle in case of a multi-frame sprite or after the display of each frame.
The latter case would be desired.
Is the change done after each cycle in case of a multi-frame sprite or after the display of each frame.
The latter case would be desired.
- Mr. Kibernetik
- Site Admin
- Posts: 4786
- Joined: Mon Nov 19, 2012 10:16 pm
- My devices: iPhone, iPad, MacBook
- Location: Russia
- Flag:
Re: 3.4 version
"Animation cycle" may be understood as one full animation cycle of a character. But this feature is activated on each frame.
It also works for single-frame sprites and allows to make any kind of automaic movements for static images. So, it will be confusing to say "on each animation frame" because these sprites consist of only one frame.
So, I called it "animation turn" here. If you know better word instead of "turn" please tell me
It also works for single-frame sprites and allows to make any kind of automaic movements for static images. So, it will be confusing to say "on each animation frame" because these sprites consist of only one frame.
So, I called it "animation turn" here. If you know better word instead of "turn" please tell me
- Dutchman
- Posts: 851
- Joined: Mon May 06, 2013 9:21 am
- My devices: iMac, iPad Air, iPhone
- Location: Netherlands
- Flag:
Re: 3.4 version
For multi-frame sprites I see each frame as a motion-phase.
I don't understand how it will work on 'static' sprites. Do you then also need to set a 'cycle-time' by which the position is periodically updated?
I don't understand how it will work on 'static' sprites. Do you then also need to set a 'cycle-time' by which the position is periodically updated?
- Mr. Kibernetik
- Site Admin
- Posts: 4786
- Joined: Mon Nov 19, 2012 10:16 pm
- My devices: iPhone, iPad, MacBook
- Location: Russia
- Flag:
Re: 3.4 version
Yes, you are right.
For single-frame sprite you can set delay value, and this will set animation cycle speed exactly as for multi-frame sprite.
For single-frame sprite you can set delay value, and this will set animation cycle speed exactly as for multi-frame sprite.
- Dutchman
- Posts: 851
- Joined: Mon May 06, 2013 9:21 am
- My devices: iMac, iPad Air, iPhone
- Location: Netherlands
- Flag:
Re: 3.4 version
Very attractive and code-saving. Thanks!
- Mr. Kibernetik
- Site Admin
- Posts: 4786
- Joined: Mon Nov 19, 2012 10:16 pm
- My devices: iPhone, iPad, MacBook
- Location: Russia
- Flag:
Re: 3.4 version
Documentation about sprites will be partially modified.
For example, this text will be added:
Sprites can be single-frame or multi-frame. Besides frame animation available for multi-frame sprites, animation commands like SPRITE PLAY or SPRITE LOOP can perform regular animation of different sprite parameters (coordinates, rotation angle, scale) which can be set with SPRITE DA command. In this case any sprite will be animated with current delay value. For example, program:
OPTION ANGLE DEGREES
SPRITE "mySprite" DELAY 0.04
SPRITE "mySprite" DA 5
SPRITE "mySprite" LOOP
will rotate sprite "mySprite" on 5 degrees every 0.04 seconds. If this is a multi-frame sprite then its frame animation will be also performed.
Please note that animation is performed only when program is running. If program stops then animation also stops.
For example, this text will be added:
Sprites can be single-frame or multi-frame. Besides frame animation available for multi-frame sprites, animation commands like SPRITE PLAY or SPRITE LOOP can perform regular animation of different sprite parameters (coordinates, rotation angle, scale) which can be set with SPRITE DA command. In this case any sprite will be animated with current delay value. For example, program:
OPTION ANGLE DEGREES
SPRITE "mySprite" DELAY 0.04
SPRITE "mySprite" DA 5
SPRITE "mySprite" LOOP
will rotate sprite "mySprite" on 5 degrees every 0.04 seconds. If this is a multi-frame sprite then its frame animation will be also performed.
Please note that animation is performed only when program is running. If program stops then animation also stops.