Opticka 2.16.1
Opticka is an experiment manager for behavioral research.
Loading...
Searching...
No Matches
animationManager Class Reference

ANIMATIONMANAGER Provides per frame paths for stimuli We integrate dyn4j java physics engine for rigid body. The plan is to also support sinusoidal, brownian, circular etc. More...

Detailed Description

ANIMATIONMANAGER Provides per frame paths for stimuli We integrate dyn4j java physics engine for rigid body. The plan is to also support sinusoidal, brownian, circular etc.

s = screenManager();
b = imageStimulus('size',4,'filePath','moon.png','name','moon');
b.speed = 25; % will define velocity
b.angle = -45; % will define velocity
a = animationManager();
sv = open(s); % open screen
setup(b, s); % initialise stimulus with open screen
addScreenBoundaries(a, sv); % add floor, ceiling and walls based on the screen
addBody(a, b); % add stimulus as a rigidbody to animationManager
setup(a); % initialise the simulation.
for i = 1:60
draw(b); % draw the stimulus
flip(s); % flip the screen
step(a); % step the simulation
end

@TODO build the code for the different types of motion

Copyright ©2014-2024 Ian Max Andolina — released: LGPL3, see LICENCE.md

Inheritance diagram for animationManager:

Public Member Functions

function animationManager (in varargin)
 Class constructor.
 
function addBody (in me, in stimulus, in shape, in type, in density, in friction, in elasticity, in av)
 
function editBody (in me, in body, in x, in y, in vx, in vy, in av)
 
function rmBody (in me, in id)
 
function resetBodies (in me)
 
function update (in me)
 
function setup (in me, in screen, in useBounds)
 
function isCollision (in me, in body)
 
function addScreenBoundaries (in me, in sv, in padding)
 addScreenBoundaries add physical walls at the screen edges
 
function step (in me, in varargin)
 
function reset (in me)
 Load an image.
 
function getBody (in me, in id)
 return the first body matching name or hash
 
function getFixture (in me, in name, in num)
 
function getBodyName (in me, in hash)
 
function get nBodies (in me)
 
- Public Member Functions inherited from optickaCore
function optickaCore (in varargin)
 Class constructor.
 
function get fullName (in me)
 
function getALF (in me, in subject, in sessionPrefix, in lab, in create)
 
function findAttributes (in me, in attrName, in attrValue)
 
function findAttributesandType (in me, in attrName, in attrValue, in type)
 find properties of object with specific attributes, for example all properties whose GetAcccess attribute is public and type is logical.
 
function findPropertyDefault (in me, in propName)
 
function clone (in me)
 Use this syntax to make a deep copy of the object, i.e. OBJ_OUT has the same field values, but will not behave as a handle-copy of me anymore.
 
function checkSuperclasses (in List)
 
function editProperties (in me, in properties)
 method to modify a set of properties
 
function setProp (in me, in property, in value)
 method to fast change a particular value. This is useful for use in anonymous functions, like in the state machine.
 
function initialiseGlobals (in me, in doReset, in doOpen)
 
function initialiseSaveFile (in me)
 Initialise Save prefix.
 
function checkPaths (in me)
 checks the paths are valid
 

Static Public Member Functions

static function vector2 (in x, in y)
 dyn4j Vector2
 
static function demo ()
 
static function d2r (in degrees)
 degrees2radians
 
static function r2d (in r)
 radians2degrees
 
static function findDistance (in x1, in y1, in x2, in y2)
 findDistance in X and Y coordinates
 
static function updatePosition (in delta, in angle)
 updatePosition returns dX and dY given an angle and delta
 
static function bezier (in t, in P)
 bezier function
 
- Static Public Member Functions inherited from optickaCore
static function makeArgs (in args)
 Converts cell args to structure array.
 
static function addDefaults (in args, in defs)
 add default options to arg input
 
static function hasKey (in in, in key)
 check if a struct / object has a propery / field
 
static function getKeys (in device)
 PTB Get key presses, stops key bouncing.
 

Public Attributes

Property type
 
Property bodies
 bodyList
 
Property rigidParams
 parameters for each animation type
 
Property sinusoidalParams
 
Property brownianParams
 
Property timeDelta
 
Property verbose
 verbose?
 
Property timeToEnd
 default length of the animation in seconds if prerendering
 
Property boundsCheck
 what happens at edge of screen [bounce | wrap | none]
 
Property nBodies
 
Property nObstacles
 
- Public Attributes inherited from optickaCore
Property name
 object name
 
Property comment
 comment
 
Property verbose
 verbose logging, subclasses must assign this. This is normally logical true/false
 
Property dateStamp
 clock() dateStamp set on construction
 
Property uuid
 universal ID
 
Property paths
 storage of various paths
 
Property fullName
 The fullName is the object name combined with its uuid and class name.
 

Protected Member Functions

function getBodyIDX (in me, in id)
 return the first body matching name or hash
 
function rigidStep (in me, in tick, in updatePositions)
 
function updateBodyPositions (in me)
 
function setupWorld (in me)
 
function setupBodies (in me)
 
function setupBody (in me, in thisBody)
 
function updateStimuli (in me)
 
function makeTrackIndex (in me)
 
function delete (in me)
 delete is the object Destructor Destructor automatically called when object is cleared
 
- Protected Member Functions inherited from optickaCore
function parseArgs (in me, in args, in allowedProperties)
 Sets properties from a structure or normal arguments pairs, ignores invalid or non-allowed properties.
 
function addArgs (in me, in args)
 
function setPaths (in me)
 Sets properties from a structure or normal arguments pairs, ignores invalid or non-allowed properties.
 
function getFonts (in me)
 set paths for object
 
function toStructure (in me)
 Converts properties to a structure.
 
function getType (in me, in in)
 
function logOutput (in me, in in, in message, in override)
 Give a metaproperty return the likely property class.
 
function salutation (in me, in varargin)
 Prints messages dependent on verbosity.
 

Protected Attributes

Property screen
 
Property useBounds
 
Property trackIndex
 
Property isFloor
 
Property isLeftWall
 
Property isRightWall
 
Property isCeiling
 
Property massType
 
Property bodyTemplate
 
Property allowedProperties
 what properties are allowed to be passed on construction
 
- Protected Attributes inherited from optickaCore
Property cloning
 are we cloning this from another object
 
Property mversion
 Matlab version number, this is transient so it is not saved.
 
Property sansFont
 sans font
 
Property monoFont
 monoFont
 
Property className
 class name
 
Property savePrefix
 save prefix generated from clock time
 
Property fullName_
 cached full name
 

Constructor & Destructor Documentation

◆ animationManager()

function animationManager::animationManager ( in  varargin)

Class constructor.

We use parseArgs to parse allowed properties on construction.

Parameters
vararginare passed as a structure of properties which is parsed.
Returns
instance of class.

Member Function Documentation

◆ addBody()

function animationManager::addBody ( in  me,
in  stimulus,
in  shape,
in  type,
in  density,
in  friction,
in  elasticity,
in  av 
)
Parameters
stimulus– the stimulus object
shape– what shape to give it in the physics simulation
type– normal (move & collide) | infinite (non-moveable, collidable) | sensor (non-moveable, non-collidable)
density
friction
elasticity
angularvelocity– initial angular velocity

◆ addScreenBoundaries()

function animationManager::addScreenBoundaries ( in  me,
in  sv,
in  padding 
)

addScreenBoundaries add physical walls at the screen edges

Parameters
svscreenVals from screenManager
padding[left top right bottom]

◆ bezier()

static function animationManager::bezier ( in  t,
in  P 
)
static

bezier function

◆ d2r()

static function animationManager::d2r ( in  degrees)
static

degrees2radians

◆ delete()

function animationManager::delete ( in  me)
protected

delete is the object Destructor Destructor automatically called when object is cleared

◆ demo()

static function animationManager::demo ( )
static

◆ editBody()

function animationManager::editBody ( in  me,
in  body,
in  x,
in  y,
in  vx,
in  vy,
in  av 
)

◆ findDistance()

static function animationManager::findDistance ( in  x1,
in  y1,
in  x2,
in  y2 
)
static

findDistance in X and Y coordinates

◆ getBody()

function animationManager::getBody ( in  me,
in  id 
)

return the first body matching name or hash

◆ getBodyIDX()

function animationManager::getBodyIDX ( in  me,
in  id 
)
protected

return the first body matching name or hash

◆ getBodyName()

function animationManager::getBodyName ( in  me,
in  hash 
)

◆ getFixture()

function animationManager::getFixture ( in  me,
in  name,
in  num 
)

◆ isCollision()

function animationManager::isCollision ( in  me,
in  body 
)

◆ makeTrackIndex()

function animationManager::makeTrackIndex ( in  me)
protected

◆ nBodies()

function get animationManager::nBodies ( in  me)

◆ r2d()

static function animationManager::r2d ( in  r)
static

radians2degrees

◆ reset()

function animationManager::reset ( in  me)

Load an image.

◆ resetBodies()

function animationManager::resetBodies ( in  me)

◆ rigidStep()

function animationManager::rigidStep ( in  me,
in  tick,
in  updatePositions 
)
protected

◆ rmBody()

function animationManager::rmBody ( in  me,
in  id 
)

◆ setup()

function animationManager::setup ( in  me,
in  screen,
in  useBounds 
)

◆ setupBodies()

function animationManager::setupBodies ( in  me)
protected

◆ setupBody()

function animationManager::setupBody ( in  me,
in  thisBody 
)
protected

◆ setupWorld()

function animationManager::setupWorld ( in  me)
protected

◆ step()

function animationManager::step ( in  me,
in  varargin 
)

◆ update()

function animationManager::update ( in  me)

◆ updateBodyPositions()

function animationManager::updateBodyPositions ( in  me)
protected

◆ updatePosition()

static function animationManager::updatePosition ( in  delta,
in  angle 
)
static

updatePosition returns dX and dY given an angle and delta

◆ updateStimuli()

function animationManager::updateStimuli ( in  me)
protected

◆ vector2()

static function animationManager::vector2 ( in  x,
in  y 
)
static

dyn4j Vector2

Member Data Documentation

◆ allowedProperties

Property animationManager::allowedProperties
protected

what properties are allowed to be passed on construction

◆ bodies

Property animationManager::bodies

bodyList

◆ bodyTemplate

Property animationManager::bodyTemplate
protected

◆ boundsCheck

Property animationManager::boundsCheck

what happens at edge of screen [bounce | wrap | none]

◆ brownianParams

Property animationManager::brownianParams

◆ isCeiling

Property animationManager::isCeiling
protected

◆ isFloor

Property animationManager::isFloor
protected

◆ isLeftWall

Property animationManager::isLeftWall
protected

◆ isRightWall

Property animationManager::isRightWall
protected

◆ massType

Property animationManager::massType
protected

◆ nBodies

Property animationManager::nBodies

◆ nObstacles

Property animationManager::nObstacles

◆ rigidParams

Property animationManager::rigidParams

parameters for each animation type

◆ screen

Property animationManager::screen
protected

◆ sinusoidalParams

Property animationManager::sinusoidalParams

◆ timeDelta

Property animationManager::timeDelta

◆ timeToEnd

Property animationManager::timeToEnd

default length of the animation in seconds if prerendering

◆ trackIndex

Property animationManager::trackIndex
protected

◆ type

Property animationManager::type

type of animation path, rigid | linear | sinusoidal | brownian | circular only rigid supported so far

◆ useBounds

Property animationManager::useBounds
protected

◆ verbose

Property animationManager::verbose

verbose?


The documentation for this class was generated from the following file: