이 페이지에서

Qt Quick 예제 - 이미지 요소

이 페이지는 이미지 유형과 관련된 QML 예제 모음입니다.

AnimatedSprite로 표시된 하나의 프레임: 3D로 렌더링된 우퍼

‘이미지 요소’는 이미지 유형과 관련된 간단한 QML 예제 모음입니다. 자세한 내용은 ‘QML의 사용 사례 - 시각적 요소’를 참조하십시오.

예제 실행

다음 위치에서 예제를 실행할 수 있습니다.

BorderImage를 사용한 크기 조정

BorderImage는 horizontalTileMode 및 verticalTileMode 속성을 설정하여 BorderImage 유형의 다양한 스케일링 모드를 보여줍니다.

이미지 채우기

Image는 Image 유형의 다양한 채우기 모드를 보여줍니다.

그림자 효과

'Shadows'에서는 ` BorderImage`를 사용하여 직사각형 항목에 드롭 섀도우 효과를 적용하는 방법을 보여줍니다.

    BorderImage {
        anchors.fill: rectangle
        anchors {
            leftMargin: -6
            topMargin: -6
            rightMargin: -8
            bottomMargin: -8
        }
        border {
            left: 10
            top: 10
            right: 10
            bottom: 10
        }
        source: "pics/shadow.png"
    }

AnimatedSprite를 사용한 스프라이트 애니메이션

AnimatedSprite는 ` AnimatedSprite ` 객체를 사용하여 간단한 애니메이션을 표시하는 방법을 보여줍니다:

    AnimatedSprite {
        id: sprite

        anchors.centerIn: parent
        source: "pics/speaker.png"
        frameCount: 60
        frameSync: true
        frameWidth: 170
        frameHeight: 170
        loops: 3
    }

스프라이트 애니메이션은 세 번 반복됩니다.

SpriteSequence를 이용한 스프라이트 애니메이션

SpriteSequence는 스프라이트 시퀀스를 사용하여 움직이고 상호작용이 가능한 곰을 그리는 방법을 보여줍니다. SpriteSequence 객체는 다섯 가지 서로 다른 스프라이트를 정의합니다. 곰은 처음에는 정지된 상태입니다:

        Sprite {
            name: "still"
            source: "pics/BearSheet.png"
            frameCount: 1
            frameWidth: 256
            frameHeight: 256
            frameDuration: 100
            to: {"still":1, "blink":0.1, "floating":0}
        }

씬을 클릭하면 애니메이션이 스프라이트 시퀀스를 ‘떨어지는’ 상태로 설정하고 곰의 y 속성을 애니메이션화합니다.

    SequentialAnimation {
        id: anim

        ScriptAction { script: image.goalSprite = "falling" }
        NumberAnimation {
            target: image
            property: "y"
            to: 480
            duration: 12000
        }
        ScriptAction {
            script: {
                image.goalSprite = ""
                image.jumpTo("still")
            }
        }
        PropertyAction {
            target: image
            property: "y"
            value: 0
        }
    }

애니메이션이 끝나면 곰은 초기 상태로 되돌아갑니다.

예제 프로젝트 @ code.qt.io

© 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.