1 /*******************************************************************************
\r
2 * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.
\r
3 * All rights reserved. This program and the accompanying materials
\r
4 * are made available under the terms of the Eclipse Public License v1.0
\r
5 * which accompanies this distribution, and is available at
\r
6 * http://www.eclipse.org/legal/epl-v10.html
\r
9 * VTT Technical Research Centre of Finland - initial API and implementation
\r
10 *******************************************************************************/
\r
11 package org.simantics.proconf.g3d.animation;
\r
13 import java.util.ArrayList;
\r
14 import java.util.List;
\r
16 import org.simantics.db.Graph;
\r
17 import org.simantics.db.Resource;
\r
19 public class ResourceAnimationController implements AnimationController {
\r
20 List<Animatable> animatables = new ArrayList<Animatable>();
\r
24 public ResourceAnimationController(Resource source) {
\r
25 this.source = source;
\r
28 public void addAnimatable(Animatable animatable) {
\r
29 animatables.add(animatable);
\r
33 public void setAnimatable(Animatable animatable) {
\r
34 animatables.clear();
\r
35 animatables.add(animatable);
\r
39 protected double getValue(Graph graph) {
\r
40 //return PropertyUtils.getScalarDoubleValue(source);
\r
41 return graph.getScalarDouble(source);
\r
42 //source.getDoubleValue();
\r
45 public void updateAnimation(Graph graph, double frameTime) {
\r
46 double d = getValue(graph);
\r
47 d = d - Math.floor(d);
\r
50 } else if (d < 0.0) {
\r
53 for (Animatable a : animatables)
\r
54 a.animate(d,frameTime);
\r
57 public void dispose() {
\r