Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. How to Give shadow to an Animated image?
Forum Updated to NodeBB v4.3 + New Features

How to Give shadow to an Animated image?

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
1 Posts 1 Posters 138 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    Jaswenth S
    wrote on last edited by Jaswenth S
    #1

    Hi geeks..
    I am trying to give a shadow effect in a png image which is in an animation loop , So I cant able to produce dropshadow effect for that image . kindly help me in this

    import QtQuick 2.9
    import QtQuick.Window 2.2
    import QtQml 2.12
    import QtGraphicalEffects 1.12
    
    
    
    Item {
        id:item
        width:350
        height: 230
                                                                                                           
        Image{
            id: img
            source: "qrc:/assets/image.png"
         anchors.horizontalCenter: parent.horizontalCenter
           anchors.verticalCenter: item.verticalCenter
           transformOrigin: Item.Center
    
            SequentialAnimation {
               id: sq
               running:true
               loops: 2                                                                        
    
               ScaleAnimator{
                   id: scaleanim_up
                   target: img
                   from: 0.15
                   to: 0.18
                   duration: 120;
    
               }
    
               ScaleAnimator{
                   id: scaleanim_down
                   target: img
                   from: 0.18
                   to: 0.15
                   duration: 120;
    
               }
           }                                                                               
    
            Timer{
               id:timer
               interval: 1000
               repeat: true
               running: true
               triggeredOnStart: false
    
               onTriggered: {
    
                   sq.start();
    
    
               }
    
            }
    
    }
    
        DropShadow {
                          anchors.fill: img
                          transparentBorder: true
                         horizontalOffset: 8
                          verticalOffset: 8
                         color:"#000000";
                         source: img
               }
    }
    

    but I am facing issues in this like if I give a drop shadow to the image the animation stops so how to get both shadow and animation in a qml code

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved