static final void method1978(boolean bool, IComponentDefinitions widget) { anInt6903++; if (bool == false) { if (Class204.anInt2461 == widget.anInt4814) { if (Class295.myPlayer.aString11142 == null) { widget.anInt4864 = 0; widget.anInt4683 = 0; } else { widget.anInt4815 = 150; widget.anInt4821 = (int) (Math.sin((double) Class174.clientCycle / 40.0) * 256.0) & 0x7ff; widget.modelType = 5; widget.anInt4864 = Class166.myPlayerIndex; widget.anInt4683 = Class51_Sub1.method522(Class295.myPlayer.aString11142, (byte) -104); Animator animator = Class295.myPlayer.anAnimator10860; if (animator == null) { widget.anAnimator4755 = null; } else { if (widget.anAnimator4755 == null) { widget.anAnimator4755 = new FixedAnimator(); } widget.anInt4773 = animator.method250((byte) 104); widget.anAnimator4755.method232(18634, animator); } } } } }
void setMessage(Animator a) { anim = a; who.setText(a.author()); ref.setText(a.description()); pan.remove(last); last = a.container(); pan.add(last, "Center"); if (T != null) T.interrupt(); }
public void init(GLAutoDrawable drawable) { GL gl = drawable.getGL(); gl.glMatrixMode(GL.GL_PROJECTION); gl.glLoadMatrixd(this._nyar.getGlProjectionMatrix(), 0); gl.glEnable(GL.GL_DEPTH_TEST); gl.glClearColor(0.0f, 0.0f, 0.0f, 0.0f); Animator animator = new Animator(drawable); animator.start(); return; }
/** * Sets the target object for all current {@link #getChildAnimations() child animations} of this * AnimatorSet that take targets ({@link ObjectAnimator} and AnimatorSet). * * @param target The object being animated */ @Override public void setTarget(Object target) { for (Node node : mNodes) { Animator animation = node.animation; if (animation instanceof AnimatorSet) { animation.setTarget(target); } else if (animation instanceof ObjectAnimator) { animation.setTarget(target); } } }
public void fireAnimation(final MyAnimations.MyAnim myAnim, final boolean shouldTurn) { if (a != null && a.isAlive()) { a.interrupt(); a = null; // try { // a.join(); // } catch (InterruptedException e) { // e.printStackTrace(); // } } a = new Animator(myAnim, shouldTurn, this); a.start(); // TODO: reuse the object }
/** * Set the values attached to each of the {@link Animator}s using the given interpolant. * * @param interpolant A value between 0 and 1. */ protected void setImpl(double interpolant) { boolean allStopped = true; for (Animator a : animators) { if (a != null) { if (a.hasNext()) { allStopped = false; a.set(interpolant); } } } if (allStopped) { this.stop(); } }
public GlintHawkIdolAbility1(GameState state) { super( state, "(W): Glint Hawk Idol becomes a 2/2 Bird artifact creature with flying until end of turn."); this.setManaCost(new ManaPool("(W)")); Animator animate = new Animator(ABILITY_SOURCE_OF_THIS, 2, 2); animate.addSubType(SubType.BIRD); animate.addType(Type.ARTIFACT); animate.addType(Type.CREATURE); animate.addAbility(org.rnd.jmagic.abilities.keywords.Flying.class); this.addEffect( createFloatingEffect( "Glint Hawk Idol becomes a 2/2 Bird artifact creature with flying until end of turn.", animate.getParts())); }
@Override public void render() { Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); Gdx.gl.glClearColor(1, 1, 1, 1); // Show the map TiledMapRenderer mapRender = MapManager.getMap("zelda"); mapRender.setView(m_camera); myAnimator.setMap(mapRender, m_camera); m_batch.begin(); /*Sprite sprite = SpriteManager.getSprite("mogloo") ; sprite.setPosition(50.f, 50.f) ; sprite.draw(m_batch) ;*/ myAnimator.render(); m_batch.end(); }
@Override @SuppressWarnings("unchecked") public void onAnimationEnd(Animator animation) { animation.removeListener(this); mPlayingSet.remove(animation); Node animNode = mAnimatorSet.mNodeMap.get(animation); animNode.done = true; if (!mTerminated) { // Listeners are already notified of the AnimatorSet ending in cancel() or // end(); the logic below only kicks in when animations end normally ArrayList<Node> sortedNodes = mAnimatorSet.mSortedNodes; boolean allDone = true; int numSortedNodes = sortedNodes.size(); for (int i = 0; i < numSortedNodes; ++i) { if (!sortedNodes.get(i).done) { allDone = false; break; } } if (allDone) { // If this was the last child animation to end, then notify listeners that this // AnimatorSet has ended if (mListeners != null) { ArrayList<AnimatorListener> tmpListeners = (ArrayList<AnimatorListener>) mListeners.clone(); int numListeners = tmpListeners.size(); for (int i = 0; i < numListeners; ++i) { tmpListeners.get(i).onAnimationEnd(mAnimatorSet); } } mAnimatorSet.mStarted = false; } } }
/** * Starts the animation thread, creating and initializing it if necessary. This method is invoked * when an indeterminate progress bar should start animating. Reasons for this may include: * * <ul> * <li>The progress bar is determinate and becomes displayable * <li>The progress bar is displayable and becomes determinate * <li>The progress bar is displayable and determinate and this UI is installed * </ul> * * If you implement your own animation thread, you must override this method. * * @since 1.4 * @see #stopAnimationTimer */ protected void startAnimationTimer() { if (animator == null) { animator = new Animator(); } animator.start(getRepaintInterval()); }
public AnimateTreetop(GameState state) { super( state, "(1)(G): Treetop Village becomes a 3/3 green Ape creature with trample until end of turn. It's still a land."); this.setManaCost(new ManaPool("1G")); Animator animator = new Animator(ABILITY_SOURCE_OF_THIS, 3, 3); animator.addColor(Color.GREEN); animator.addSubType(SubType.APE); animator.addAbility(org.rnd.jmagic.abilities.keywords.Trample.class); this.addEffect( createFloatingEffect( "Treetop Village becomes a 3/3 green Ape creature with trample until end of turn. It's still a land.", animator.getParts())); }
public TezzeretAgentofBolasAbility1(GameState state) { super( state, -1, "Target artifact becomes an artifact creature with base power and toughness 5/5."); SetGenerator target = targetedBy(this.addTarget(ArtifactPermanents.instance(), "target artifact")); Animator animate = new Animator(target, 5, 5); animate.addType(Type.ARTIFACT); animate.removeOldTypes(); this.addEffect( createFloatingEffect( Empty.instance(), "Target artifact becomes an artifact creature with base power and toughness 5/5.", animate.getParts())); }
@Override public Node clone() { try { Node node = (Node) super.clone(); node.animation = animation.clone(); return node; } catch (CloneNotSupportedException e) { throw new AssertionError(); } }
@Override public void create() { float w = Gdx.graphics.getWidth(); float h = Gdx.graphics.getHeight(); walkAnimator = new Animator(1, 7); slideAnimator = new Animator(1, 3); player = new AnimatableEntity(1); camera = new OrthographicCamera(); camera.setToOrtho(false, w, h); batch = new SpriteBatch(); test = new Entity(); /*adding frame dimensions(this is a really cumbersome task if u have a complex sprite sheet.But its totally worth it.when managing animations in render(). */ walkAnimator.addFrameDimesion(0, 0, 0, 70, 64); walkAnimator.addFrameDimesion(1, 82, 0, 70, 64); walkAnimator.addFrameDimesion(2, 152, 0, 70, 64); walkAnimator.addFrameDimesion(3, 236, 0, 70, 64); walkAnimator.addFrameDimesion(4, 312, 0, 70, 64); walkAnimator.addFrameDimesion(5, 382, 0, 70, 64); walkAnimator.addFrameDimesion(6, 457, 0, 70, 64); /*create animation from the spritesheet.As we have already given the co ordinates for a particular animation,just sit back and watch.Animator class will create the animation for u. */ anim = walkAnimator.createAnimation("data/walk.png", .2f); slideAnimator.addFrameDimesion(0, 0, 0, 78, 64); slideAnimator.addFrameDimesion(1, 78, 0, 90, 64); slideAnimator.addFrameDimesion(2, 168, 0, 90, 64); slideAnimator.createAnimation("data/slide.png", .2f); stateTime = 0; /* * finally adding all animators to Animatable entity. * */ player.attachAnimator(walkAnimator, "walk"); player.attachAnimator(slideAnimator, "slide"); player.setCurrentAnimator("walk"); }
public void run() { if (Thread.currentThread() != T) throw new Error("do not call directly -- use start()"); while (T != null) { int d = anim.doTick(); if (d < 50) d = 50; if (d > 2000) d = 2000; try { Thread.sleep(d); } catch (Exception ex) { } } }
public GlintHawkIdolAbility0(GameState state) { super( state, "Whenever another artifact enters the battlefield under your control, you may have Glint Hawk Idol become a 2/2 Bird artifact creature with flying until end of turn."); this.addPattern( new SimpleZoneChangePattern( null, Battlefield.instance(), RelativeComplement.instance(HasType.instance(Type.ARTIFACT), ABILITY_SOURCE_OF_THIS), You.instance(), false)); Animator animate = new Animator(ABILITY_SOURCE_OF_THIS, 2, 2); animate.addSubType(SubType.BIRD); animate.addType(Type.ARTIFACT); animate.addType(Type.CREATURE); animate.addAbility(org.rnd.jmagic.abilities.keywords.Flying.class); this.addEffect( youMay( createFloatingEffect( "Glint Hawk Idol becomes a 2/2 Bird artifact creature with flying until end of turn.", animate.getParts()), "You may have Glint Hawk Idol become a 2/2 Bird artifact creature with flying until end of turn.")); }
boolean tryDir(String d) { ClassLoader L = getClass().getClassLoader(); File p = new File(d, PACKAGE); System.out.println("Try " + p); if (!p.exists() || !p.isDirectory()) return false; for (File f : p.listFiles()) { String s = f.getName(); if (!s.endsWith(".class")) continue; String name = s.substring(0, s.length() - 6); try { Class<?> c = L.loadClass(PACKAGE + "." + name); if (!Animator.class.isAssignableFrom(c)) continue; Animator a = (Animator) c.newInstance(); a.container().setPreferredSize(DIM); map.put(name, a); System.out.println(" " + name); // ClassNotFoundException InstantiationException IllegalAccessException } catch (Exception e) { continue; } } return map.size() > 0; }
public void resume() { paused = false; if (animator != null) { synchronized (animator) { animator.notify(); } } if (loader != null) { synchronized (loader) { loader.notify(); } } }
public AzoriusKeyruneAbility1(GameState state) { super( state, "(W)(U): Azorius Keyrune becomes a 2/2 white and blue Bird artifact creature with flying until end of turn."); this.setManaCost(new ManaPool("(W)(U)")); Animator animator = new Animator(ABILITY_SOURCE_OF_THIS, 2, 2); animator.addColor(Color.WHITE); animator.addColor(Color.BLUE); animator.addSubType(SubType.BIRD); animator.addType(Type.ARTIFACT); animator.addAbility(org.rnd.jmagic.abilities.keywords.Flying.class); this.addEffect( createFloatingEffect( "Azorius Keyrune becomes a 2/2 white and blue Bird artifact creature with flying until end of turn.", animator.getParts())); }
public OrzhovKeyruneAbility1(GameState state) { super( state, "(W)(B): Orzhov Keyrune becomes a 1/4 white and black Thrull artifact creature with lifelink until end of turn."); this.setManaCost(new ManaPool("(W)(B)")); Animator animate = new Animator(ABILITY_SOURCE_OF_THIS, 1, 4); animate.addColor(Color.WHITE); animate.addColor(Color.BLACK); animate.addSubType(SubType.THRULL); animate.addType(Type.ARTIFACT); animate.addAbility(Lifelink.class); this.addEffect( createFloatingEffect( "Orzhov Keyrune becomes a 1/4 white and black Thrull artifact creature with lifelink until end of turn.", animate.getParts())); }
@Override public void create() { spriteAnime = "img/mogloo.png"; myAnimator = new Animator(spriteAnime, 4, 4, 30, 30); myAnimator.create(); m_screen = new Screen(Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); m_batch = new SpriteBatch(); // Camera! m_camera = new OrthographicCamera(); m_camera.setToOrtho(false, 30, 20); // The camera will show an area of 30x20 tiles of the map m_camera.update(); try { SpriteManager.addSprite("img", "boss.png"); SpriteManager.addSprite("img", "mogloo.png"); MapManager.addMap("maps", "zelda.tmx", m_batch); } catch (Exception e) { e.printStackTrace(); } }
/** * Check whether the event received is one that the node was waiting for. If so, mark it as * complete and see whether it's time to start the animation. * * @param dependencyAnimation the animation that sent the event. */ private void startIfReady(Animator dependencyAnimation) { if (mAnimatorSet.mTerminated) { // if the parent AnimatorSet was canceled, then don't start any dependent anims return; } Dependency dependencyToRemove = null; int numDependencies = mNode.tmpDependencies.size(); for (int i = 0; i < numDependencies; ++i) { Dependency dependency = mNode.tmpDependencies.get(i); if (dependency.rule == mRule && dependency.node.animation == dependencyAnimation) { // rule fired - remove the dependency and listener and check to // see whether it's time to start the animation dependencyToRemove = dependency; dependencyAnimation.removeListener(this); break; } } mNode.tmpDependencies.remove(dependencyToRemove); if (mNode.tmpDependencies.size() == 0) { // all dependencies satisfied: start the animation mNode.animation.start(); mAnimatorSet.mPlayingSet.add(mNode.animation); } }
// Start/stop animation public void setAnimation(boolean on) { if (on) animator.start(); else animator.stop(); }
/** * Stops the animation thread. This method is invoked when the indeterminate animation should be * stopped. Reasons for this may include: * * <ul> * <li>The progress bar changes to determinate * <li>The progress bar is no longer part of a displayable hierarchy * <li>This UI in uninstalled * </ul> * * If you implement your own animation thread, you must override this method. * * @since 1.4 * @see #startAnimationTimer */ protected void stopAnimationTimer() { if (animator != null) { animator.stop(); } }
public void startAnimation() { if (view().drawing() instanceof Animatable && fAnimator == null) { fAnimator = new Animator((Animatable) view().drawing(), view()); fAnimator.start(); } }
// Constructora public Principal() { // Titulo de la ventana y tamaño setTitle("Práctica 4"); setSize(new Dimension(425, 500)); super.setResizable(false); // Contenedor del editor panel = this.getContentPane(); panel.setBackground(Color.blue); panel.setLayout(new BorderLayout()); // Generamos el menu menu = new JMenuBar(); archivo = new JMenu("Archivo"); nuevo = new JMenuItem("Nuevo"); salir = new JMenuItem("Salir"); sobre = new JMenu("Sobre.."); autores = new JMenuItem("Autores"); menu.add(archivo); archivo.add(nuevo); archivo.add(salir); menu.add(sobre); sobre.add(autores); setJMenuBar(menu); // Creamos los botones this.panelBotones = new JPanel(); panelBotones.setLayout(new GridLayout(3, 3)); panel.add(panelBotones, BorderLayout.SOUTH); botonDefinirPuntos = new JButton("Definir Perfil"); botonDefinirPuntos.setVisible(true); panelBotones.add(botonDefinirPuntos); botonAplicarSplines = new JButton("BSplines"); botonAplicarSplines.setVisible(true); panelBotones.add(botonAplicarSplines); botonGenerarMallaRevolucion = new JButton("Revolución"); botonGenerarMallaRevolucion.setVisible(true); panelBotones.add(botonGenerarMallaRevolucion); botonGenerarMallaExtrusion = new JButton("Extrusión"); botonGenerarMallaExtrusion.setVisible(true); panelBotones.add(botonGenerarMallaExtrusion); botonCambiarModo = new JButton("Cambiar Modo"); botonCambiarModo.setVisible(true); panelBotones.add(botonCambiarModo); botonDibujarNormales = new JButton("Activa Normales"); botonDibujarNormales.setVisible(true); panelBotones.add(botonDibujarNormales); // Definimos el tipo de malla actual a representar this.tipoMalla = 0; // Definimos un perfil por defecto this.perfil = new ArrayList<PuntoVector3D>(); this.perfil.add(new PuntoVector3D(250, 330, 0, 1)); this.perfil.add(new PuntoVector3D(250, 300, 0, 1)); this.perfil.add(new PuntoVector3D(230, 270, 0, 1)); this.perfil.add(new PuntoVector3D(200, 240, 0, 1)); this.perfil.add(new PuntoVector3D(200, 210, 0, 1)); this.perfil.add(new PuntoVector3D(200, 180, 0, 1)); this.perfil.add(new PuntoVector3D(200, 150, 0, 1)); this.perfil.add(new PuntoVector3D(230, 120, 0, 1)); // Creamos el canvas de dibujo canvas = new GLJPanel(); escena = new GL3D(425, 425); canvas.addGLEventListener(escena); canvas.addMouseListener(new ManejadorRaton()); panel.add(canvas, BorderLayout.CENTER); // Transformamos el perfil a coordenadas de la escena this.perfil = escena.transformarPerfil(this.perfil); escena.setPerfil(this.perfil); // Animación de la escena animacion = new Animator(canvas); animacion.start(); // Entrada de datos desactivada entradaDatos = false; // Acción por defecto al cerrar la ventana this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); // Evento Oyente para la barra de menu "nuevo" nuevo.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { perfil = new ArrayList<PuntoVector3D>(); escena.actualizarPerfil(tipoMalla, perfil); } }); // Evento Oyente para la barra de menu "Autores" autores.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { JOptionPane.showMessageDialog( null, "Iván Romero\nPedro Sánchez", "Autores", JOptionPane.INFORMATION_MESSAGE); } }); // Evento Oyente para el boton "Definir Perfil" botonDefinirPuntos.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { perfil = new ArrayList<PuntoVector3D>(); escena.setPerfil(perfil); entradaDatos = true; } }); // Evento Oyente para el boton "Aplicar Splines" botonAplicarSplines.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { String dato = JOptionPane.showInputDialog( null, "Numero de puntos de control. Rango[" + perfil.size() + "...N]", "Datos de Entrada", 1); if (dato != null) { int num = Integer.parseInt(dato); perfil = new Calculos().calculaPuntosBSplines(perfil, num); if (perfil.size() > num) { ArrayList<PuntoVector3D> perfilAux = new ArrayList<PuntoVector3D>(); for (int i = 0; i < num - 2; i++) { perfilAux.add(perfil.get(i)); } perfil = (ArrayList<PuntoVector3D>) perfilAux.clone(); } escena.setPerfil(perfil); entradaDatos = false; } } }); // Evento Oyente para el boton "Malla Revolución" botonGenerarMallaRevolucion.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { // String datoNumVertices = "4"; String datoAng = JOptionPane.showInputDialog("Ángulo de rotación: ", "0.15"); if (datoAng != null) { Object[] opciones = {"3", "4"}; int eleccion = JOptionPane.showOptionDialog( null, "Número de Vértices de la cara: ", "Datos de Entrada", JOptionPane.DEFAULT_OPTION, JOptionPane.WARNING_MESSAGE, null, opciones, opciones[0]); int numVerticesCara = Integer.parseInt((String) opciones[eleccion]); double anguloRadianes = Double.parseDouble(datoAng); mallaActual = new MallaPorRevolucion(perfil, numVerticesCara, anguloRadianes); // mallaRevolucion = new MallaPorRevolucion(perfil, numVerticesCara, anguloRadianes); // escena.actualizarMallaRev(2, mallaRevolucion); escena.actualizarMalla(2, mallaActual); escena.setGenerado(true); entradaDatos = false; } } }); // Evento Oyente para el boton "Malla Extrusión" botonGenerarMallaExtrusion.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { String SnP = JOptionPane.showInputDialog( "Número de lados que aproximan la sección del toroide", "10"); String SnQ = JOptionPane.showInputDialog("Número de capas del toroide", "50"); String Sr1 = JOptionPane.showInputDialog("Radio del toro", "150"); String Sr2 = JOptionPane.showInputDialog("Radio de la sección del toro", "20"); int nP = Integer.parseInt(SnP); int nQ = Integer.parseInt(SnQ); float r1 = Float.parseFloat(Sr1); float r2 = Float.parseFloat(Sr2); mallaActual = new Toro(nP, nQ, r1, r2); escena.actualizarMalla(3, mallaActual); escena.setGenerado(true); entradaDatos = false; } }); // Evento Oyente para el botón "Cambiar Modo" botonCambiarModo.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { Object[] opciones = {"Puntos", "Líneas", "Sólidos"}; int eleccion = JOptionPane.showOptionDialog( null, "Cambiar Modo de Representación a: ", "Datos de Entrada", JOptionPane.DEFAULT_OPTION, JOptionPane.WARNING_MESSAGE, null, opciones, opciones[0]); mallaActual.setTipoMalla(eleccion); } }); // Evento Oyente para el botón "Dibujar Normales" botonDibujarNormales.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { if (botonDibujarNormales.getText().equals("Activa Normales")) { botonDibujarNormales.setText("DesactivaNormales"); mallaActual.setNormales(true); } else { botonDibujarNormales.setText("Activa Normales"); mallaActual.setNormales(false); } } }); // Añadimos un evento para la acción de salida addWindowListener( new WindowAdapter() { @Override public void windowClosing(WindowEvent e) { new Thread( new Runnable() { public void run() { animacion.stop(); System.exit(0); } }) .start(); } }); }
// Check if animation is proceeding public boolean isAnimated() { return animator.isAnimating(); }
public void endAnimation() { if (fAnimator != null) { fAnimator.end(); fAnimator = null; } }
public String message() { return anim.description(); }
public void testAnimation() { Animator animator = new Animator(null, new Coordinate(4, 67), new Coordinate(145, 120)); System.err.println(animator.toString()); }