<script setup lang="ts">
import { ref, onMounted, onUnmounted, reactive, toRefs } from "vue";
import { gsap, TweenMax, TweenLite } from 'gsap'
import { ScrollTrigger } from 'gsap/ScrollTrigger'
//const props = defineProps({
//})
//const emit = defineEmits([
//])
const imgItem1 = ref(null)
const imgItem2 = ref(null)
const imgItem3 = ref(null)
const imgItem4 = ref(null)
const imgBox = ref(null)
let data = reactive({
})
onMounted(()=>{
	let dom = document.querySelector('body')
	gsap.registerPlugin(ScrollTrigger);
	let tl1 = gsap.timeline();
	tl1.from(imgItem1.value,1, {y:'200px',opacity:0,ease:'power2.out'},0)
	tl1.from(imgItem2.value,1, {y:'200px',opacity:0,ease:'power2.out'},0.2) 
	tl1.from(imgItem3.value,1, {y:'200px',opacity:0,ease:'power2.out'},0.4)
	tl1.from(imgItem4.value,1, {y:'200px',opacity:0,ease:'power2.out'},0.6)
	ScrollTrigger.create({
		trigger: imgBox.value, // 触发器元素
		start: "top 90%", // 滚动触发器的起始滚动位置
		end: '100% 80%',   // 滚动触发器的结束滚动位置
		markers: false, // 开启标注功能
		animation:tl1,
		scroller:dom,//设置指定元素为滚动依据
		toggleActions: "play reset play reset",
		scrub:false,
	});
})
onUnmounted(()=>{
})
defineExpose({})
const {} = toRefs(data);
</script>
<template>
	<section class="our-team">
		<div class="content">
			<h2>Our Team</h2>
		</div>
	</section>
	<section class="our-team-item bg1">
		<div class="content">
			<div class="text"></div>
			<div class="img">
				<img src="https://code-create.com.hk/wp-content/uploads/2022/11/about_team_01-600x887.png" alt="">
			</div>
		</div>
	</section>
</template>
<style lang="less" scoped>
	.our-team{
		width: 100%;
		background-color: #f9f9f9;
		> .content{
			margin: 0 auto;
			max-width: 730px;
			padding: 100px 0px 100px 0px;
			> h2{
				text-align: center;
				margin-bottom: 30px;
				color: #000000;
				font-size: 40px;
				font-weight: 600;
				letter-spacing: 1px;
				font-family: "Poppins", Sans-serif;
			}
		}
	}
	.our-team-item{
		width: 100%;
		&.bg1{
			background-color: #eeeeee;
		}
		&.bg2{
			background-color: #ffffff;
		}
		> .content{
			padding: 100px 0;
			max-width: 960px;
			margin: 0 auto;
			display: flex;
			> div{
				width: 50%;
			}
			> .img{
				text-align: right;
				> img{
					width: 100%;
					max-width: 330px;
				}
			}
		}
	}
</style>