Learn what Felgo offers to help your business succeed. Start your free evaluation today! Felgo for Your Business

Forums

OverviewFelgo 3 Support (Qt 5) › How anmation Works ?

Tagged: , ,

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #14226

    Victor

    Hi wodering, does the animation needs to be set within the Entity ?

     

    Meaning I have simple rectange EntityBase which I show in the defalut scene, and want to animate its moving to a diff position (in x or y), can I do that from the main.qml flie or should I do something similar to the 2028 sample by forc e (meaning setting the animation wihin the Rectangle.qml file)

    I havesomething like this in my main.qml file

     

    Block{
      anchors.centerIn: parent
            }
    
    NumberAnimation{
      id:animateBlock
      target:Block
      property:"x"
      from:0
      to:50
    }

     

    And this my rectangle.qml file

    import Felgo 3.0
    import QtQuick 2.0
    
    EntityBase {
    
        entityId: "rectangle1"
        entityType: "customEntity"
    
        Rectangle {
            id: block
            width: 30
            height: 50
            color: "red"        
        }   
    }

    So far I’m getting this error: qrc:///qml/VPlay/core/EntityBase.qml:567: ReferenceError: entityManager is not defined

     

    Sorry Im just starting with vPlay and not very proficient with JS

    Hope you understand my doubt, thx in advance.

    #14227

    Günther
    Felgo Team

    Hi Victor!

    The animation system is quite flexible. You can define the animation either in the item itself, or in another file where you actually use this item. Everything should work as long as the animation has access to the target item and the animated property.

    For EntityBase: Entities in Felgo can be dynamically created and added during runtime of your game are managed by the EntitiyManager. It keeps track of all the dynamically created entities and allows to retrieve entities based on their id. As soon as you use an entity with EntityBase, you should also add the EntityManager to your project:

     import Felgo 3.0
     import QtQuick 2.0
    
     GameWindow {
    
       EntityManager {
         id: entityManager
         entityContainer: scene
       }
    
       Scene {
         id: scene
    
         // .. all game code goes in here ..
       }
     }

     

    If you are new to Felgo, I strongly recommend to work through some of our getting started or game tutorials. You can also have a look at the free and open source demos and examples provided in the Felgo Sample Launcher.

    Best,
    Günther

     

     

Viewing 2 posts - 1 through 2 (of 2 total)

RSS feed for this thread

You must be logged in to reply to this topic.

Qt_Technology_Partner_RGB_475 Qt_Service_Partner_RGB_475_padded