이 페이지에서

ColorAnimation QML Type

색상 값의 변화를 애니메이션으로 표현합니다. 더 보기...

Import Statement: import QtQuick
Inherits:

PropertyAnimation

속성

상세 설명

ColorAnimation은 색상 값이 변경될 때 적용될 애니메이션을 정의하는 특수한 PropertyAnimation 입니다.

다음은 ` Rectangle `의 ` color ` 속성에 속성 값 소스로 적용된 `ColorAnimation`의 예시입니다. 이 애니메이션은 ` color ` 속성의 값을 현재 값에서 "red" 값으로 1000밀리초에 걸쳐 애니메이션 처리합니다:

import QtQuick

Rectangle {
    width: 100; height: 100
    color: "red"

    ColorAnimation on color { to: "yellow"; duration: 1000 }
}

다른 애니메이션 유형과 마찬가지로, ColorAnimation도 전환, 동작 및 속성 값 소스 등 다양한 방법으로 적용할 수 있습니다. ' Qt Quick 의 애니메이션 및 전환' 문서에서는 애니메이션을 생성하는 다양한 방법을 보여줍니다.

편의상, Transition 에서 ColorAnimation을 사용할 경우, 상태 변경 중에 수정된 모든 color 속성이 애니메이션 처리됩니다. 애니메이션에 대해 property 또는 properties 가 명시적으로 설정된 경우, 해당 속성이 대신 사용됩니다.

Qt Quick 의 ‘애니메이션 및 전환 ’ 및 ‘Qt Quick 예제 - 애니메이션’도 참조하십시오 .

속성 문서

from : color

이 속성은 애니메이션이 시작되어야 하는 색상 값을 지정합니다.

예를 들어, 다음 애니메이션은 색상 값이 "#c0c0c0"에 도달할 때까지 적용되지 않습니다:

Item {
    states: [
        // States are defined here...
    ]

    transitions: Transition {
        ColorAnimation { from: "#c0c0c0"; duration: 2000 }
    }
}

ColorAnimation 가 Transition 또는 Behavior 내에서 정의된 경우, 이 값은 기본적으로 Transition 의 시작 상태에 정의된 값이나, Behavior 가 트리거된 시점의 해당 속성 현재 값을 사용합니다.

Qt Quick 의 ‘애니메이션 및 전환(Animation and Transitions)’항목도 참조하십시오 .

to : color

이 속성은 애니메이션이 종료되어야 할 색상 값을 지정합니다.

ColorAnimation 가 Transition 또는 Behavior 내에서 정의된 경우, 이 값은 기본적으로 Transition 의 종료 상태에 정의된 값이나, Behavior 를 트리거한 속성 변경의 값으로 설정됩니다.

Qt Quick 의 ‘애니메이션 및 전환’항목도 참조하십시오 .

© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.