<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[How to animate HSL filter as a colour animation (or equivalent)?]]></title><description><![CDATA[<p dir="auto">Okay, so I want to change the hue of an object with the HSL filter effect, so that the hues in the image change relatively.<br />
The problem is that, when animating this, i can only animate the "hue" property - there is no "colour" property that i can animate.</p>
<p dir="auto">This means that the animation ends up as a rainbow flash of "inbetween hues" rather than a kind of "blend transition" of the two hues that would happen if you were animating by colour.</p>
<p dir="auto">The reason for using a HSL filter as opposed to another kind of colourising approach is that it is the only one that keeps the relative hues / saturations separate and is not a "blanked overlay".</p>
<p dir="auto">For anyone wishing to try this out:</p>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/import">@<bdi>import</bdi></a> QtQuick 2.0<br />
import QtGraphicalEffects 1.0<br />
Row {<br />
Rectangle {<br />
id: color_animation<br />
width: 266<br />
height: 266<br />
color: "#00adee"</p>
<pre><code>    Behavior on color {
//    ColorAnimation on color {
        ColorAnimation {
            duration: 360
            easing.type: Easing.Linear
        }
    }

}
Item {
    width: 266
    height: 266
    HueSaturation {
        id: filter
        width: 266
        height: 266
        source: filter_rect
        hue: -0.35933147632311977715877437325905

        Behavior on hue {
            NumberAnimation {
                duration: 360
                easing.type: Easing.Linear
            }
        }
    }
    Image {
        id: filter_rect
        width: 266
        height: 266
        source:"images/pink_rect.png"
        visible: false
    }
}
focus: true
Keys.onReturnPressed: {
    color_animation.color == "#00adee" ? color_animation.color = "#ed008a" : color_animation.color = "#00adee"
    filter.hue == 0 ? filter.hue = -0.35933147632311977715877437325905 : filter.hue = 0
</code></pre>
<p dir="auto">}<br />
}@</p>
<p dir="auto">Where pink_rect.png is a single pixel image of colour #ed008a .</p>
<p dir="auto">Thanks!</p>
]]></description><link>https://forum.qt.io/topic/38263/how-to-animate-hsl-filter-as-a-colour-animation-or-equivalent</link><generator>RSS for Node</generator><lastBuildDate>Sun, 03 May 2026 09:29:31 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/38263.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 25 Feb 2014 12:42:56 GMT</pubDate><ttl>60</ttl></channel></rss>