--@input float curTime = 0.0{"widget":"slider","min":0,"max":3.0} local exports = exports or {} local faceScript = faceScript or {} faceScript.__index = faceScript function faceScript.new(construct, ...) local self = setmetatable({}, faceScript) if construct and faceScript.constructor then faceScript.constructor(self, ...) end self.startTime = 0.0 self.endTime = 3.0 self.curTime = 0.0 self.first = nil self.organParams = { 0.0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.0, 0, 0.0, 0, 0, 0, 0, 0, 0, 0.0, 2, 0, 0, } self.percent = -1 self.intensity = 0 return self end function faceScript:constructor() end function faceScript:onUpdate(comp, detalTime) self:seekToTime(comp, self.curTime - self.startTime) end function faceScript:start(comp) self.comp = comp.entity.scene:findEntityBy("faceScript"):getComponent("FaceReshape") end function faceScript:seekToTime(comp, time) if self.first == nil then self.first = true self:start(comp) end if self.percent ~= self.intensity then self.percent = self.intensity local intensities = Amaz.Vector() for i = 1, #self.organParams do intensities:pushBack(self.organParams[i]) end intensities:set(1, self.organParams[2]+ 0.14*self.percent) self.comp.params.degrees = intensities end end function faceScript:onEvent(sys, event) if event.type == Amaz.AppEventType.SetEffectIntensity then if "intensity" == event.args:get(0) then self.intensity = event.args:get(1) end end end exports.faceScript = faceScript return exports