Your Digital Media Has Never Looked So Good

 
User avatar
dreamer2057
Topic Author
Posts: 62
Joined: Thu Oct 09, 2014 7:28 am
Contact:

Dynamic animation

Tue Feb 02, 2016 2:16 pm

Can I work with animation dynamically?

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.
 
lumpenprole
Posts: 15
Joined: Wed Apr 22, 2015 10:37 am

Re: Dynamic animation

Tue May 03, 2016 10:04 am

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
Posts: 66
Joined: Mon Sep 26, 2016 6:25 am

Re: Dynamic animation

Mon Jun 25, 2018 2:36 pm

I am just encountering this. Was there ever a resolution to this? Can we dynamically modify the "fieldToInterp" field?
 
lumpenprole
Posts: 15
Joined: Wed Apr 22, 2015 10:37 am

Re: Dynamic animation

Mon Jun 25, 2018 2:57 pm

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
Posts: 66
Joined: Mon Sep 26, 2016 6:25 am

Re: Dynamic animation

Mon Jun 25, 2018 9:45 pm

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...

screenAnimationInterp.fieldToInterp = screen.id + ".opacity"
screenAnimation.control = "start"
 
ajitg_4557
Posts: 26
Joined: Thu Feb 16, 2017 5:53 am
Location: Noida,Uttar pradesh,India
Contact:

Re: Dynamic animation

Thu Jul 05, 2018 5:02 am

   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.
 
User avatar
squirreltown
Posts: 848
Joined: Sun Apr 21, 2013 2:20 pm

Re: Dynamic animation

Thu Jul 05, 2018 6:42 am

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"
Kinetics Screensavers
 
User avatar
coopdaddyswag
Posts: 24
Joined: Thu Mar 22, 2018 6:21 pm

Re: Dynamic animation

Fri Jan 11, 2019 7:46 pm

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

Who is online

Users browsing this forum: destruk and 2 guests