
dreamer2057
Channel Surfer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-02-2016
01:16 PM
Dynamic animation
Can I work with animation dynamically?
those code from xml can be moved into brightscript?
those code from xml can be moved into brightscript?
<ParallelAnimation id = "ShowMenu" > <!--** ParallelAnimation id = "testParallelAnimation" repeat = "true" **-->
<Animation id = "testPosterAnimation" duration = "1" easeFunction = "linear" >
<Vector2DFieldInterpolator key= "[0, 1]" keyValue= "[ [640, 1000], [640, 620] ]" fieldToInterp="menuBar.translation" />
<FloatFieldInterpolator key= "[0, 1]" keyValue= "[ 0.2, 1]" fieldToInterp="menuBar.opacity" />
</Animation>
<Animation id = "testPosterBckgAnimation" duration = "1" easeFunction = "linear" >
<Vector2DFieldInterpolator key= "[0, 1]" keyValue= "[ [0, 870], [0, 490] ]" fieldToInterp="testPosterBckg.translation" />
<FloatFieldInterpolator key= "[0, 1]" keyValue= "[ 0.2, 1 ]" fieldToInterp="testPosterBckg.opacity" />
</Animation>
<Animation id = "testPosterSelectAnimation" duration = "1" easeFunction = "linear" >
<Vector2DFieldInterpolator key= "[0, 1]" keyValue= "[ [230, 910], [230, 530] ]" fieldToInterp="testPosterSelect.translation" />
<FloatFieldInterpolator key= "[0, 1]" keyValue= "[ 0.2, 1 ]" fieldToInterp="testPosterSelect.opacity" />
</Animation>
</ParallelAnimation>
Sincerely, Sergey Shoshin, software developer.
7 REPLIES 7
lumpenprole
Channel Surfer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-03-2016
10:04 AM
Re: Dynamic animation
So, I'm curious about this too. It seems like trying to set fieldToInterp in code fails. Can we get an example of this?
jaxim
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-25-2018
02:36 PM
Re: Dynamic animation
I am just encountering this. Was there ever a resolution to this? Can we dynamically modify the "fieldToInterp" field?
lumpenprole
Channel Surfer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-25-2018
02:57 PM
Re: Dynamic animation
I've never found a solution. I set a bunch of stripped down animations in the xml, and modify what I can in the code.
jaxim
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-25-2018
09:45 PM
Re: Dynamic animation
actually, I found a solution that works for me.
It works when I set the fieldToInterp in the code. I am animating a screen. Here is my code...
It works when I set the fieldToInterp in the code. I am animating a screen. Here is my code...
screenAnimationInterp.fieldToInterp = screen.id + ".opacity"
screenAnimation.control = "start"
ajitg_4557
Channel Surfer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-05-2018
05:02 AM
Re: Dynamic animation
i, jaxim
can you share some part of the code snippet, where you write code for screen animation and also how you find screen id?
:shock: :idea:
thanks in advance.
can you share some part of the code snippet, where you write code for screen animation and also how you find screen id?
:shock: :idea:
thanks in advance.

squirreltown
Roku Guru
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-05-2018
06:42 AM
Re: Dynamic animation
I don't use XML at all. All animations can be done in Brightscript .
Init:
Init:
m.mainannie = m.top.createChild("ParallelAnimation")
m.mainannie.id="ThisAnnie"
m.mainannie.repeat = false
m.nodez.clr[i]=m.mainannie.CreateChild("Animation")
m.nodez.clr[i].id="color_"+i.toStr()
m.nodez.clrcha[i]=m.nodez.clr[i].CreateChild("ColorFieldInterpolator")
m.nodez.clrcha[i].id="colorcha_"+i.toStr()
m.nodez.clrcha[i].fieldToInterp= "player_"+i.toStr()+".blendcolor"
etc.....
m.mainannie.control = "start"
Kinetics Screensavers

coopdaddyswag
Binge Watcher
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-11-2019
06:46 PM
Re: Dynamic animation
"squirreltown" wrote:
I don't use XML at all. All animations can be done in Brightscript .
Init:m.mainannie = m.top.createChild("ParallelAnimation")
m.mainannie.id="ThisAnnie"
m.mainannie.repeat = false
m.nodez.clr[i]=m.mainannie.CreateChild("Animation")
m.nodez.clr[i].id="color_"+i.toStr()
m.nodez.clrcha[i]=m.nodez.clr[i].CreateChild("ColorFieldInterpolator")
m.nodez.clrcha[i].id="colorcha_"+i.toStr()
m.nodez.clrcha[i].fieldToInterp= "player_"+i.toStr()+".blendcolor"
etc.....
m.mainannie.control = "start"
Can confirm that this works. I was creating separate objects, then using `#appendChild` to construct the node tree. However, that was not working properly. Instead I decided to use `#createChild`. Here is a code sample:
function _createAnimation(objToAnimate as Object) as Object
animation = createObject("roSGNode", "Animation")
animation.id = Substitute("{0}{1}", objToAnimate.id, "Animation")
animation.delay = 1
animation.duration = 5
animation.easeFunction = "linear"
floatField = animation.createChild("FloatFieldInterpolator")
floatField.key = [0.0, 0.125, 0.250, 0.375, 0.5, 0.625, 0.750, 0.875, 1.0]
floatField.keyValue = [0.0, 0.25, 0.5, 0.75, 1.0, 0.75, 0.5, 0.25, 0.0]
floatField.fieldToInterp = "ticker.opacity"
return animation
end function